/*
* This file is a part of the open-eBackup project.
* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
* If a copy of the MPL was not distributed with this file, You can obtain one at
* http://mozilla.org/MPL/2.0/.
*
* Copyright (c) [2024] Huawei Technologies Co.,Ltd.
*
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
*/
#ifndef OBS_PLUGIN_H
#define OBS_PLUGIN_H
#include <string>
#include <vector>
#include "ApplicationProtectBaseDataType_types.h"
#include "ApplicationProtectPlugin_types.h"
#include "ApplicationProtectFramework_types.h"
#include "common/JsonHelper.h"
#include "PluginGeneralTypes.h"
#include "JobFactoryBase.h"
#include "CommonJobFactory.h"
#include "common/CommonStruct.h"

#define OBSPLUGIN_API __attribute__((visibility("default")))
#ifdef __cplusplus
extern "C" {
#endif

// Agent初始化调用
OBSPLUGIN_API int AppInit(std::string &logPath);
// 资源接入时会调用该接口，检查连通性
OBSPLUGIN_API void CheckApplication(
    ActionResult &returnValue, const ApplicationEnvironment &appEnv, const Application &application);
// 列举对象资源的接口，未实现
OBSPLUGIN_API void ListApplicationResource(std::vector<ApplicationResource> &returnValue,
    const ApplicationEnvironment &appEnv, const Application &application, const ApplicationResource &parentResource);
// 列举对象资源的接口（V2）
OBSPLUGIN_API void ListApplicationResourceV2(ResourceResultByPage &returnValue, const ListResourceRequest &request);
OBSPLUGIN_API void QueryJobPermission(AppProtect::JobPermission& returnJobPermission, const Application& application);
OBSPLUGIN_API void AllowBackupInLocalNode(ActionResult& returnValue, const AppProtect::BackupJob& job,
    const AppProtect::BackupLimit::type limit);
OBSPLUGIN_API void AllowBackupSubJobInLocalNode(
    ActionResult& returnValue, const AppProtect::BackupJob& job, const AppProtect::SubJob& subJob);
OBSPLUGIN_API void AllowRestoreInLocalNode(ActionResult& returnValue, const AppProtect::RestoreJob& job);
OBSPLUGIN_API void AllowRestoreSubJobInLocalNode(
    ActionResult& returnValue, const AppProtect::RestoreJob& job, const AppProtect::SubJob& subJob);
OBSPLUGIN_API void CheckBackupJobType(ActionResult& returnValue, const AppProtect::BackupJob& job);
OBSPLUGIN_API JobFactoryBase* CreateFactory();
void CheckObsConnect(ActionResult& returnValue, const AppProtect::BackupJob& job);
void CheckObsConnectInner(ActionResult& returnValue, const Module::StorageType& storageType,
    const OBSPlugin::ObjectStorageAuthExtendInfo& authInfo);
#ifdef __cplusplus
}
#endif
#endif
